package com.cdwm.mrp.controller.view;


import com.cdwm.mrp.domain.po.Host;
import com.cdwm.mrp.service.HostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @version v1.0
 * @Author: lyw
 * @Date: 2021/8/19
 */
@Controller
@RequestMapping("/host")
public class HostControllerView {

    @Autowired
    private HostService hostService;

    @GetMapping("/view/system/hostView")
    public String hostMainView(){
        return "view/system/host/host";
    }

    @GetMapping("/view/system/add")
    public String addHostView(){
        return "view/system/host/add";
    }

    @GetMapping("/view/system/edit/{id}")
    public String editHostView(@PathVariable Long id, Model model){
        Host host = hostService.getById(id);
        model.addAttribute("host",host);
        return "view/system/host/edit";
    }
}
